<%@page import="com.sun.corba.se.impl.naming.pcosnaming.NameServer"%>
<%@ page language="java" contentType="text/html; charset=utf-8"
	pageEncoding="utf-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ page import="member.*"%>
<%@ page import="java.io.*"%>

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<script type="text/javascript">
	function validate(form) {
		
		var f = document.member;
		
		var checked = 0;
		for (var i = 0; i < f.elements.length; i++) //특정 영역을 체크 할때는 숫자로 대신 한다 예: for(i=3;i<21;i++)
		{
			if(((f.elements[i].name == "chk") && (f.elements[i].checked)) && (f.elements[i].name != "mb_mailing")) {
				checked++;
			}
		}
		
		if(checked == 0){
			alert("약관에 동의하세요.");
			return false;
		} else if (form.mb_name.value == "") {
			alert("이름을 입력하세요");
			return false;
		} else if (form.mb_id.value == "") {
			alert("아이디를 입력하세요.");
			return false;
		} else if (form.mb_pw.value == "") {
			alert("비밀번호를 입력하세요.");
			return false;
		} else if (form.mb_pw.value != form.mb_pwOk.value) {
			alert("비밀번호가 일치하지 않습니다.");
			return false;
		} else if (form.mb_ans.value == "") {
			alert("비밀번호 답변을 입력하세요.");
			return false;
		}  

		alert(form.mb_pw.value);
		alert(form.mb_pwOk.value);
		return false;
		
	}
	
	function chk_id(f) {
		id = f.mb_id.value;
		if (f.mb_id.value == "") {
			alert("아이디를 입력하세요.");
			f.mb_id.focus();
			return;
		}
		w = window.open("idCheck.jsp?id=" + id, "", "width=250,height=150");
	}
</script>

<%@ include file="/Dmyna/head.jsp"%>

<!-- 상단제목 -->
<table width="900" align=center cellpadding=0 cellspacing=0>
	<tr>
		<td>
			<div
				style="border:1px solid #ddd; height:34px; background:url(${WEB_ROOT }/img/bbs/title_bg.gif) repeat-x;">
				<div
					style="font-weight: bold; font-size: 14px; margin: 7px 0 0 10px;"
					align="center">::&nbsp;&nbsp;회원 가입&nbsp;&nbsp;::</div>
			</div>
		</td>
	</tr>
</table>
<p>


<form action="/memberInsert.do" method="post" onSubmit="return validate(this)" name="member">
	<table width="900" align="center" cellpadding="0" cellspacing="0">
		
		<tr>
		<td colspan="3" align="center">
		<font style="font-weight:bold">이용약관</font>
		</td>
		</tr>
		<tr>
		<td colspan="3" align="center">
		<textarea name="clause" rows="10" cols="120" readonly="readonly" style="overflow-y:scroll" >
		<%
			BufferedReader reader = null;
			try {
				String filePath = application
						.getRealPath("/Dmyna/txt/constitution.txt");
				reader = new BufferedReader(new FileReader(filePath));
				while (true) {
					String str = reader.readLine();
					if (str == null)
						break;
					out.println(str);

				}
			} catch (FileNotFoundException fnfe) {
				out.println("파일이 존재하지 않습니다.");
			} catch (IOException ioe) {
				out.println("파일을 읽을 수 없습니다.");
			} finally {
				try {
					reader.close();
				} catch (Exception e) {
				}
			}
		%>
		</textarea>
		</td>
		</tr>
		<tr>
		<td colspan="3" align="center">
		<input type="checkbox" name="chk">약관에 동의합니다.
		</td>
		</tr>
		<tr>
			<td colspan=2 height=20></td>
		</tr>
		<tr>
			<td width="200"></td>
			<td width="80" align="left" bgcolor=#e7e7e7>&nbsp;&nbsp;이름</td>
			<td width="150" align="left"><input type="text" name="mb_name" /></td>
		</tr>
		<tr>
			<td colspan=2 height=1></td>
		</tr>
		<tr>
			<td width="100"></td>
			<td align="left" bgcolor=#e7e7e7>&nbsp;&nbsp;아이디</td>
			<td align="left"><input type="text" name="mb_id" /> &nbsp;&nbsp; <input
				type="button" value="중복확인" onClick="chk_id(this.form)" /></td>
		</tr>
		<tr>
			<td colspan=2 height=1></td>
		</tr>
		<tr>
			<td width="100"></td>
			<td align="left" bgcolor=#e7e7e7>&nbsp;&nbsp;비밀번호</td>
			<td align="left"><input type="password" name="mb_pw" /></td>
		</tr>
		<tr>
			<td colspan=2 height=1></td>
		</tr>
		<tr>
			<td width="100"></td>
			<td align="left" bgcolor=#e7e7e7>&nbsp;&nbsp;비밀번호 확인</td>
			<td align="left"><input type="password" name="mb_pwOk" /></td>
		</tr>
		<tr>
			<td colspan=2 height=1></td>
		</tr>
		<tr>
			<td width="100"></td>
			<td align="left" bgcolor=#e7e7e7>&nbsp;&nbsp;비밀번호 질문</td>
			<td align="left"><select name="mb_pw_que">
					<option value="자신의 인생 좌우명은?">자신의 인생 좌우명은?</option>
					<option value="자신의 보물 제1호는?">자신의 보물 제1호는?</option>
					<option value="기억에 남는 추억의 장소는?">기억에 남는 추억의 장소는?</option>
					<option value="가장 기억에 남는 선생님 성함은?">가장 기억에 남는 선생님 성함은?</option>
					<option value="추억하고 싶은 날짜가 있다면?">추억하고 싶은 날짜가 있다면?</option>
			</select></td>
		</tr>
		<tr>
			<td colspan=2 height=1></td>
		</tr>
		<tr>
			<td width="100"></td>
			<td align="left" bgcolor=#e7e7e7>&nbsp;&nbsp;비밀번호 답변</td>
			<td align="left"><input type="text" size="40" name="mb_pw_ans" /></td>
		</tr>
		<tr>
			<td colspan=2 height=1></td>
		</tr>
		<tr>
			<td width="100"></td>
			<td align="left" bgcolor=#e7e7e7>&nbsp;&nbsp;전화번호</td>
			<td align="left"><input type="text" name="mb_tel" /></td>
		</tr>
		<tr>
			<td colspan=2 height=1></td>
		</tr>
		<tr>
			<td width="100"></td>
			<td align="left" bgcolor=#e7e7e7>&nbsp;&nbsp;핸드폰 번호</td>
			<td align="left"><input type="text" name="mb_phone" /></td>
		</tr>
		<tr>
			<td colspan=2 height=1></td>
		</tr>
		<tr>
			<td width="100"></td>
			<td align="left" bgcolor=#e7e7e7>&nbsp;&nbsp;이메일</td>
			<td align="left"><input type="text" name="mb_email" /></td>
		</tr>
		<tr>
			<td colspan=2 height=1></td>
		</tr>
		<tr>
			<td width="100"></td>
			<td align="left" bgcolor=#e7e7e7>&nbsp;&nbsp;메일정보수신</td>
			<td align="left"><input type="checkbox" name="mb_mailing" value="y">받습니다.</td>
		</tr>
		<tr>
			<td colspan=2 height=1></td>
		</tr>
		<tr>
			<td width="100"></td>
			<td align="left" bgcolor=#e7e7e7>&nbsp;&nbsp;우편번호</td>
			<td align="left"><input type="text" name="mb_zip" /></td>
		</tr>
		<tr>
			<td colspan=2 height=1></td>
		</tr>
		<tr>
			<td width="100"></td>
			<td align="left" bgcolor=#e7e7e7>&nbsp;&nbsp;기본 주소</td>
			<td align="left"><input type="text" size="60" name="mb_addr1" /></td>
		</tr>
		<tr>
			<td colspan=2 height=1></td>
		</tr>
		<tr>
			<td width="100"></td>
			<td align="left" bgcolor=#e7e7e7>&nbsp;&nbsp;나머지 주소</td>
			<td align="left"><input type="text" size="60" name="mb_addr2" /></td>
		</tr>
		<tr>
			<td colspan=2 height=1></td>
		</tr>
		<tr>
			<td width="100"></td>
			<td>&nbsp;</td>
			<td></td>
		</tr>
		<tr>
			<td colspan="3" align="center"><input type="submit" value="회원등록">
				<input type="reset" value="다시쓰기"> <input type="button"
				value="돌아가기" onClick="javascript:history.go(-1)" /></td>
		</tr>
	</table>
	<p>
</form>
<%@ include file="/Dmyna/tail.jsp"%>
